# 编译可执行程序
include ../../../config.mk
# 工具链
CPP = g++
CC = gcc
RM = rm -f
STRIP = strip

# 头文件路径
CFLAGS += -I../../../include 
CFLAGS += -I../../../src 
# 第三方库
EXTLIBS = -L../../debug/ -lmedia

# 编译选项
CFLAGS += -Wall -O2 -Os -g -std=c++0x

# 系统库
LDFLAGS +=  -lc 
LDFLAGS+=  -lnsl -lz -ljpeg -lpng -lresolv -L/lib/i386-linux-gnu -lgcrypt -lpthread -ldl


ifeq ($(STATIC_OPENSSL),yes)
	INCLUDE+= -I$(OPENSSL_DIR)/include
	LDFLAGS+= $(OPENSSL_DIR)/libssl.a $(OPENSSL_DIR)/libcrypto.a
	ARLIBFLAGS+= $(OPENSSL_DIR)/libssl.a $(OPENSSL_DIR)/libcrypto.a
else
	LDFLAGS+= -lssl -lcrypto
	LDLIBFLAGS+= -lssl -lcrypto
endif

# 需要编译的文件
SRCPATH = .
SOURCE += $(SRCPATH)/app.cpp
SOURCE += $(SRCPATH)/main.cpp

EXE_OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))

TARGET = ./server

all:$(TARGET)

$(TARGET):$(EXE_OBJS) 
	$(CPP) -o $@ $^  $(EXTLIBS) $(LDFLAGS)

.c.o:
	$(CC) -c $(CFLAGS) $^ -o $@

.cpp.o:
	$(CPP) -c $(CFLAGS) $^ -o $@

clean:
	$(RM) $(TARGET) $(EXE_OBJS)
